﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CaiyinSoft.NetGather.Protocol;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;

namespace CaiyinSoft.NetGather.NetGatherLib.Publisher
{
    public partial class SQLHTMLPublisherForm : InnerFormBase
    {
        public SQLHTMLPublisherForm()
        {
            InitializeComponent();
            this.TopLevel = false;

            if (ActiveEditor != null)
            {
                ActiveEditor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("TSQL");
            }

        }

        private SQLHTMLPublisher _HTMLPublisher;
        public SQLHTMLPublisher HTMLPublisher
        {
            get
            {
                if (_HTMLPublisher == null)
                {
                    return null;
                }
                else
                {
                    _HTMLPublisher.ConnectionStr = ConnectionStr;
                    _HTMLPublisher.ToExecuteSQL = ToExecuteSQL;
                    return _HTMLPublisher;
                }
            }
            set
            {
                _HTMLPublisher = value;
                ConnectionStr = value.ConnectionStr;
                ToExecuteSQL = value.ToExecuteSQL;
            }
        }

        public string ConnectionStr
        {
            get
            {
                return txtConnectionStr.Text;
            }
            set
            {
                txtConnectionStr.Text = value;
            }
        }

        public string ToExecuteSQL
        {
            get
            {
                return txtToExecuteSQL.Text;
            }
            set
            {
                txtToExecuteSQL.Text = value;
            }
        }

        private TextEditorControl ActiveEditor
        {
            get
            {
                return this.txtToExecuteSQL;
            }
        }


        private void SQLHTMLPublisherForm_Load(object sender, EventArgs e)
        {

        }
    }
}
